import request from '@/utils/request'
// 获取员工列表
export const getEmployeesListApi = (page, size) => {
  return request({
    url: '/sys/user',
    method: 'get',
    params: {
      page,
      size
    }
  })
}

// 删除员工
export const delEmployeesListApi = (id) => {
  return request({
    url: `/sys/user/${id}`,
    method: 'delete'

  })
}

// 添加员工
export const addEmployeeApi = data => {
  return request({
    url: '/sys/user',
    method: 'post',
    data
  })
}

// 批量导入员工
export const batchAddEmployeeApi = arr => {
  return request({
    url: '/sys/user/batch',
    method: 'post',
    data: arr
  })
}

/** *
 * 保存员工的基本信息
 * **/
export function saveUserDetailByIdApi(data) {
  return request({
    method: 'put',
    url: `/sys/user/${data.id}`,
    data
  })
}

/** *
 * 给员工分配角色
 * ***/
export function assignRolesApi(data) {
  return request({
    url: '/sys/user/assignRoles',
    data,
    method: 'put'
  })
}
